package com.cxy.datawarehouse.exception;


import com.cxy.datawarehouse.response.IResultStatus;

/**
 * 自定义异常
 *
 * @author admin
 */
public class BizException extends RuntimeException {

    /**
     * 响应枚举
     */
    private IResultStatus resultStatus;


    public BizException(String message) {
        super(message);
        this.resultStatus = new IResultStatus() {
            @Override
            public int getCode() {
                return -1;
            }

            @Override
            public String getMessage() {
                return message;
            }
        };
    }

    public BizException(IResultStatus resultStatus) {
        super(resultStatus.getMessage());
        this.resultStatus = resultStatus;
    }

    public BizException(Throwable cause) {
        super(cause);
    }

    public BizException(String message, Throwable cause) {
        super(message, cause);
    }


    public IResultStatus getCode() {
        return resultStatus;
    }

}
